<!DOCTYPE html>
<html xmlns=http://www.w3.org/1999/xhtml xmlns:bd=http://www.baidu.com/2010/xbdml>
<head>
    <meta http-equiv="Content-Type" content="text/html" charset="utf-8">
    <title>权限列表</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="format-detection" content="telephone=no">
    <link Rel="SHORTCUT ICON" href="/pc/login/img/logo1.png">
    <link rel="stylesheet" href="/pc/layui/css/layui.css" media="all" />
    <link rel="stylesheet" href="/pc/layout/css/font_eolqem241z66flxr.css" media="all" />
    <link rel="stylesheet" href="/pc/layout/css/news.css" media="all" />
</head>
<body class="childrenBody">
    <blockquote class="layui-elem-quote news_search" style="margin-top:1.2em;">
        <div class="layui-inline">
            <div class="layui-input-inline">
                <input type="text" value="" placeholder="请输入关键字" class="layui-input search_input">
            </div>
            <a class="layui-btn search_btn">查询</a>
        </div>
        <div class="layui-inline">
            <a class="layui-btn linksAdd_btn" style="background-color:#5FB878">添加</a>
        </div>
    </blockquote>
        <div class="layui-form links_list">
        <table class="layui-table">
         {{ csrf_field() }}
            <thead>
                <tr>
                    <th>编号</th>
                    <th>模块</th>
                    <th>级别</th>
                    <th>主题</th>
                    <th>图标</th>
                    <th>链接</th>
                    <th>在侧边栏显示</th>
                    <th>侧边栏默认展开</th>
                    <th>其他代理商可访问</th>
                    <th>操作</th>
                </tr>
            </thead>
            <tbody class="links_content">
            @if(!empty($data))
                @foreach($data as $val)
             <tr id="auth_{{$val['id']}}">
                <td>{{$val['id']}}</td>
                <td>{{$val['module']}}</td>
                <td>{{$val['level']}}</td>
                <td>{{$val['title']}}</td>
                <td><i class="layui-icon">{{$val['icon']}}</i></td>
                <td>{{$val['href']}}</td>
                <td>@if($val['gadget'] == 1)是 @else 否 @endif</td>
                 <td>@if($val['spread'] == 1)是 @else 否 @endif</td>
                 <td>@if($val['limit'] == 1)是 @else 否 @endif</td>
                 <td><a class="layui-btn layui-btn-mini links_edit" auth="{{$val['id']}}"><i class="iconfont icon-edit"></i> 编辑</a>
                    <a class="layui-btn layui-btn-danger layui-btn-mini links_del" onclick="delAuth({{$val['id']}})" data-id="1"><i class="layui-icon"></i> 删除</a>
                </td>
            </tr>
                @endforeach
            @endif
            </tbody>
        </table>
    </div>
    @if(!null == $info)
        <div style="float:right;">
            {!! $info->appends($request)->render() !!}
        </div>
    @endif
   <script type="text/javascript" src="/pc/layout/js/jquery.min.js"></script>
<script type="text/javascript" src="/pc/layui/layui.js"></script>
<script type="text/javascript" src="/pc/auth/js/auth.js"></script>
<script>
         function delAuth(id){  //删除
        layer.confirm('确定删除此信息？',{icon:3, title:'提示信息'},function(index){
            $.ajax({
                url:'/admin/auth/destroy',
                type:'post',
                async:false,
                data:{
                    "_token": $("input[name=_token]").val(),
                    'id':id
                },
                dataType:'json',
                success:function (data) {
                    if(data.status == 1){
                        $('#auth_'+id).remove();
                        layer.msg('删除成功！',{time:800});
                         layer.close(index);
                    }
                }
            })
            layer.close(index);
        });
    }




</script>
</body>
</html>